<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>家长信息</title>
	<meta name="decorator" content="default"/>
	<script src="${ctxStatic}/front/js/myValidate.js"></script> 
	<script type="text/javascript">
		$(document).ready(function() {
			//$("#name").focus();
			$("#inputForm").validate({
				rules : {
					name : {
						required: true,
						maxlength : 4
					},
					contactPhone: {
						minlength : 10,
						maxlength : 13,
						isPhone:true
					}, 
					mobile :{
						isMobile:true
					},
					isGuardian:{
						required: true
					}, 
					schoolId:{
						required: true
					}, 
					idCard :{
						required: true,
						isIdcard:true
					},
					email : {
						email : true
					},
					qq:{
						digits : true
					}
				},
				messages : {
					name : {
						required: "请填写姓名",
						maxlength : '名字少于四个字'
					},
					contactPhone: {
						minlength : '固话为区号(3-4位)号码(7-9位)',
						maxlength : '固话最多为12位'
					}, 
					mobile :{
						digits : '手机号码只能为数字',
						minlength : '手机号码长度不能小于11位',
						maxlength : '手机号码长度不能大于11位'
					},
					isGuardian:{
						required: "请选择"
					}, 
					schoolId:{
						required: "请选择"
					}, 
					idCard :{
						required : "请填写",
						minlength : '身份证号长度不能小于18位',
						maxlength : '身份证号长度不能大于18位'
					},
					email : {
						email : '请正确填写邮件格式'
					},
					qq:{
						digits : '只能为数字'
					}
				},
				submitHandler: function(form){
					loading('正在提交，请稍等...');
					form.submit();
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
		});
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li><a href="${ctx}/dd/ddParent/">家长列表</a></li>
		<li class="active"><a href="${ctx}/dd/ddParent/form?id=${ddParent.id}">家长<shiro:hasPermission name="dd:ddParent:edit">${not empty ddParent.id?'修改':'添加'}</shiro:hasPermission><shiro:lacksPermission name="dd:ddParent:edit">查看</shiro:lacksPermission></a></li>
	</ul><br/>
	<form:form id="inputForm" modelAttribute="ddParent" action="${ctx}/dd/ddParent/save" method="post" class="form-horizontal">
		<form:hidden path="id"/>
		<sys:message content="${message}"/>		
		<div class="control-group">
			<label class="control-label">
			<b style="color: red; font-size: large">*</b>家长姓名：</label>
			<div class="controls">
				<form:input path="name" htmlEscape="false" maxlength="50" class="input-xlarge " required="required"/>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">
			<b style="color: red; font-size: large">*</b>所属学校：</label>
			<div class="controls">
			 <form:select path="schoolId" class="input-mini form-control required ">
			                    <form:option value="">请选择</form:option>		
								<form:options items="${fns:getSchoolNameList()}" itemLabel="name"
									itemValue="id" htmlEscape="false" />
							</form:select>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">民族：</label>
			<div class="controls">
				<form:input path="nation" htmlEscape="false" maxlength="20" class="input-xlarge "/>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">工作单位：</label>
			<div class="controls">
				<form:input path="workUnits" htmlEscape="false" maxlength="100" class="input-xlarge "/>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">现住地：</label>
			<div class="controls">
				<form:input path="liveAddress" htmlEscape="false" maxlength="200" class="input-xlarge "/>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">户口所在地：</label>
			<div class="controls">
				<form:input path="registeredResidence" htmlEscape="false" maxlength="200" class="input-xlarge "/>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">
			<b style="color: red; font-size: large">*</b>联系电话：</label>
			<div class="controls">
				<form:input path="contactPhone" htmlEscape="false" maxlength="50" class="input-xlarge " required="required"/>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label"><b style="color: red; font-size: large">*</b>手机号码：</label>
			<div class="controls">
				<form:input path="mobile" htmlEscape="false" maxlength="20" class="input-xlarge " required="required"/>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">
			<b style="color: red; font-size: large">*</b>是否为监护人：</label>
			<div class="controls">
				<form:radiobuttons path="isGuardian"
								items="${fns:getDictList('yes_no')}" itemLabel="label"
								itemValue="value" htmlEscape="false" class="" />
			</div>
		</div>
		<div class="control-group">
			<label class="control-label"><b style="color: red; font-size: large">*</b>身份证号码：</label>
			<div class="controls">
				<form:input path="idCard" htmlEscape="false" maxlength="50" class="input-xlarge " required="required"/>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">QQ：</label>
			<div class="controls">
				<form:input path="qq" htmlEscape="false" maxlength="20" class="input-xlarge "/>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">电子邮箱：</label>
			<div class="controls">
				<form:input path="email" htmlEscape="false" maxlength="50" class="input-xlarge "/>
			</div>
		</div>
		<%-- <div class="control-group">
			<label class="control-label">卡号：</label>
			<div class="controls">
				<form:input path="cardNumber" htmlEscape="false" maxlength="50" class="input-xlarge "/>
			</div>
		</div> --%>
		<div class="form-actions">
			<shiro:hasPermission name="dd:ddParent:edit"><input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>&nbsp;</shiro:hasPermission>
			<input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
		</div>
	</form:form>
</body>
</html>